/*
 * @lc app=leetcode.cn id=1403 lang=javascript
 *
 * [1403] 非递增顺序的最小子序列
 */

// @lc code=start
/**
 * @param {number[]} nums
 * @return {number[]}
 */
var minSubsequence = function (nums) {
  nums.sort((a, b) => b - a);
  const sum = nums.reduce((p, c) => p + c);
  let res = []
  let cur = 0;
  for (let num of nums) {
    res.push(num);
    cur += num;
    if (cur + cur > sum) {
      return res;
    }
  }
};
// @lc code=end

